import Vue from 'vue'
import Router from 'vue-router'
import ElementUI from 'element-ui'
import Iview from 'iview'

import NoFound from '@/components/noFound/NoFound'
import Manage from '@/components/main/Main'
import Artical from '@/components/artical/Artical'
import EditArtical from '@/components/artical/EditArtical'
import deleteArtical from '@/components/artical/deleteArtical'

import home from '@/components/home'
import hello from '@/components/hello'
import loginIndex from '@/components/login/loginIndex'
import register from '@/components/login/register'
import login from '@/components/login/login'

import perInfo from '@/components/personInfo/perInfoIndex'
import ajax from '@/common/ajaxCommon/ajax'

import 'element-ui/lib/theme-default/index.css'
import 'iview/dist/styles/iview.css'
Vue.use(Router)
Vue.use(ElementUI)
Vue.use(Iview)
Vue.use(ajax)
//引入验证

export default new Router({
  //mode: 'history',
  routes: [
    {
      path: '*',
      component: NoFound
    },
    {
      path: '/',
      redirect: 'manage'
    },
    {
      path: '/home',
      name: 'home',
      component: home,
      children:[
        {
          path: '/manage',
          name: 'Manage',
          component: Manage
        },
        {
          path: '/artical',
          name: 'Artical',
          component: Artical
        },
        {
          path: '/editArtical',
          name: 'EditArtical',
          component: EditArtical
        },
        {
          path: '/deleteArtical',
          name: 'deleteArtical',
          component: deleteArtical
        },
        //个人信息
        {
          path: '/perInfo',
          name: 'perInfo',
          component: perInfo
        },
      ]
    },
    {
      path: '/loginIndex',
      name: 'loginIndex',
      component: loginIndex,
      children:[
        {
          path: '/login',
          name: 'login',
          component: login
        },
        {
          path: '/register',
          name: 'register',
          component: register
        },
      ]
    },
    {
      path: '/hello',
      name: 'hello',
      component: hello
    },

  ]
})
